Add missing templates to testdialog
authorMatthias Clasen <mclasen@redhat.com>
Thu, 24 Apr 2014 05:06:14 +0000 (01:06 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Sat, 26 Apr 2014 02:11:54 +0000 (22:11 -0400)
This makes the template test cases not crash. The templates also
serve to test the new action widget support.

https://bugzilla.gnome.org/show_bug.cgi?id=728846

tests/mydialog.ui [new file with mode: 0644]
tests/mydialog2.ui [new file with mode: 0644]
tests/testdialog.c

diff --git a/tests/mydialog.ui b/tests/mydialog.ui
new file mode 100644 (file)
index 0000000..b6766e0
--- /dev/null
@@ -0,0 +1,23 @@
+<interface>
+  <template class="MyDialog" parent="GtkDialog">
+    <child type="action">
+      <object class="GtkButton" id="cancel_button">
+        <property name="visible">True</property>
+        <property name="label">_Abort</property>
+        <property name="use_underline">True</property>
+      </object>
+    </child>
+    <child type="action">
+      <object class="GtkButton" id="go_button">
+        <property name="visible">True</property>
+        <property name="label">_Go</property>
+        <property name="use_underline">True</property>
+        <property name="can_default">True</property>
+      </object>
+    </child>
+    <action-widgets>
+      <action-widget response="cancel">cancel_button</action-widget>
+      <action-widget response="apply" default="True">go_button</action-widget>
+    </action-widgets>
+  </template>
+</interface>
diff --git a/tests/mydialog2.ui b/tests/mydialog2.ui
new file mode 100644 (file)
index 0000000..aa1f990
--- /dev/null
@@ -0,0 +1,14 @@
+<interface>
+  <template class="MyDialog2" parent="GtkDialog">
+    <child internal-child="vbox">
+      <object class="GtkBox">
+        <child>
+          <object class="GtkLabel" id="content">
+            <property name="visible">True</property>
+            <property name="label">template content</property>
+          </object>
+        </child>
+      </object>
+    </child>
+  </template>
+</interface>
index 59d76381b3e98a1aff0bcc1d23f95e062e264948..e38cc0cd2ddc9a432b2bb3931b73e6a96d6b7f0b 100644 (file)
@@ -216,7 +216,6 @@ show_dialog_from_template (GtkWindow *parent)
                          "transient-for", parent,
                          NULL);
 
-  add_buttons (dialog);
   add_content (dialog);
 
   gtk_dialog_run (GTK_DIALOG (dialog));
@@ -238,7 +237,6 @@ show_dialog_flex_template (GtkWindow *parent)
                          "use-header-bar", use_header,
                          NULL);
 
-  add_buttons (dialog);
   add_content (dialog);
 
   gtk_dialog_run (GTK_DIALOG (dialog));